//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;

namespace EntLibContrib.Query.Configuration
{
	/// <summary>
	/// Configuration data defining CustomCommandData. This configuration section defines the name and type
	/// of the ICustomCommand class
	/// </summary>
	[Assembler(typeof(TypeInstantiationAssembler<ICustomCommand, CustomCommandData>))]
	public class CustomCommandData : NameTypeConfigurationElement
	{
		#region Constants
		private const string commandTypeNameProperty = "commandTypeName";
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the name of type of the command.
		/// </summary>
		/// <value>The name of type of the command.</value>
		[ConfigurationProperty(commandTypeNameProperty, IsRequired = true)]
		public string CommandTypeName
		{
			get { return (string)base[commandTypeNameProperty]; }
			set { base[commandTypeNameProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="CustomCommandData"/> class.
		/// </summary>
		public CustomCommandData()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="CustomCommandData"/> class.
		/// </summary>
		/// <param name="name">The command name.</param>
		/// <param name="type">The <see cref="P:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElement.Type"/> that this element is the configuration for.</param>
		/// <param name="commandTypeName">Name of the command type.</param>
		public CustomCommandData(string name, Type type, string commandTypeName)
			: base(name, type)
		{
			this.CommandTypeName = commandTypeName;
		}
		#endregion
	}
}
